﻿Public Class NhaCungCapDAO
    Public Shared Function SelectAll() As DataTable
        Dim strSQL As String = "select * from NHACUNGCAP"
        Dim dt As DataTable
        dt = SQLProvider.ExecQuery(strSQL)
        Return dt

    End Function

    Public Shared Sub Insert(ByVal _nhacungcap As NhaCungCapDTO)
        Dim strSQL As String = "Insert into NHACUNGCAP(TenNhaCC,DiaChi,DienThoai,Email,Fax) Values('" & _nhacungcap.TenNhaCungCap & "','" & _nhacungcap.DiaChi & "',' " & _nhacungcap.DienThoai & "','" & _nhacungcap.Email & "'," & _nhacungcap.Fax & " )"
        SQLProvider.ExecNoneQuery(strSQL)

    End Sub

    Public Shared Sub Delete(ByVal _nhacungcap As NhaCungCapDTO)
        Dim strSQL As String = "delete from NHACUNGCAP where IDNhaCC = " & _nhacungcap.MaNhaCungCap
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub

    Public Shared Sub Update(ByVal _nhacungcap As NhaCungCapDTO)
        Dim strSQL As String = "Update NHACUNGCAP set TenNhaCC = '" & _nhacungcap.TenNhaCungCap & "', DiaChi = '" & _nhacungcap.DiaChi & "', DienThoai ='" & _nhacungcap.DienThoai & "', Email='" & _nhacungcap.Email & "', Fax=" & _nhacungcap.Fax & " where IDNhaCC = " & _nhacungcap.MaNhaCungCap
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub
End Class
